package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author tongchen
 * @create 2022-11-29 13:43
 */
public interface UserMapper {
    //在数据库中查询用户对象
    @Select("select *from tb_user where username=#{username} and password=#{password}")
    User select(@Param("username") String userName, @Param("password") String passWord);
    //通过用户名查找数据
    @Select("select *from tb_user where username=#{username}")
    User selectByName(String username);
    //在数据库中添加对象
    @Insert("insert into tb_user values (null,#{username},#{password})")
    void addUser(User user);
}
